<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button type="button" id="app">点击请求</button>
    <script src="http://mockjs.com/dist/mock.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" referrerpolicy="no-referrer"></script>
    <script>
        $('#app').click(function () {
            $.ajax({
                url: 'http://localhost:8085',
                type: 'get',
                dataType: 'json'
            }).done(function (data, status, xhr) {
                console.log(data, null, 2);
            })
        })

        var obj = { aa: '11', bb: '22', cc: '33', dd: '44'}
        Mock.mock('http://localhost:8085', {
            "user|1-3": [
                {
                    "id|+1": 1,
                    name: "@cname",
                    "age|18-28": 0,
                    birthday: '@date("yyyy-MM-dd")',
                    city: "@city",
                    "fromObj|2": obj 
                }
            ]
        })
    </script>
</body>
</html>